<template>
	<view class="container">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<ls-skeleton :skeleton="skeleton" :loading="skeletonLoad">
			<view>
				<view class="title">{{ data.title }}</view>
				<view class="date">{{ data.createTime }}</view>
				<view class="content">
					<u-parse :content="data.articleContent"></u-parse>
				</view>
			</view>
		</ls-skeleton>
	</view>
</template>

<script>
	import {
		getNoticeDetails
	} from '@/config/api';
	import lsSkeleton from '@/components/module/ls-skeleton/ls-skeleton.nvue';
	export default {
    name:"article-details",
		components: {
			lsSkeleton
		},
    props:{
      idStr: {
        type: String,
      }
    },
		data() {
			return {
				skeleton: [
					'card-sm',
					'line-lg',
					20,
					'line*15',
				],
				skeletonLoad: true,
				data: {}
			};
		},
    created() {
 console.log(2222222333333333)
       console.log(this.idStr)
      if(this.idStr){
        this.loadData(this.idStr);
      }
    },
		methods: {
			loadData(id) {
				let httpData = {
					id
				};
				getNoticeDetails({
					params: httpData,
					custom: {
						load: false,
						toast: false
					}
				}).then((res) => {
					uni.setNavigationBarTitle({
						title: res.title
					});
					this.data = res;
					this.skeletonLoad = false;
				}).catch(() => {
					uni.redirectTo({
						url: "/pages/error/default"
					})
				});
			}
		}
	};
</script>
<style>

</style>
<style lang="scss" scoped>
	.container {
		padding: 20rpx;

		.title {
			font-size: 30rpx;
			font-weight: bold;
		}

		.date {
			padding: 20rpx 0;
			color: #999999;
		}

		.content {
			::v-deep._p {
				font-size: 0;
			}
			padding-bottom: env(safe-area-inset-bottom);
		}
	}
</style>
